'''
删除VSS配置信息
Created on 2015年7月31日
@author: anyang
'''
import logging
import os
import re

from VSProjectUtils.projectRename import all_files 

ProjectFolder = "G:\\yczxprint测试"

# 删除VSS无效的信息 
for path1 in all_files(ProjectFolder, "*.scc;*.vssscc;*.vspscc;*.vspscc", False, True):
    os.remove(path1)
    logging.info("Delete:%s" % path1)
    
logging.info(" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ")
    
# 删除vcproj文件中无效的VSS配置信息
for path2 in all_files(ProjectFolder, "*.vcproj", False, True):
    fileContent = ''
    with open(path2, 'r') as fr:
        fileContent = fr.read()
    
    stringfo = re.compile('SccProjectName="SAK"\s*SccAuxPath="SAK"\s*SccLocalPath="SAK"\s*SccProvider="SAK"\s*')
    resString = stringfo.sub('', fileContent)
     
    with open(path2, 'w') as fw: 
        fw.write(resString)
        
    logging.info("Clean:%s" % path2)


    
    

